<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        div{
            width: 100px;height:100px;
            border: 1px solid red;
        }
        #d1{
            position: absolute;
            left: 0px;
            top: 0px;
        }
        #big{
            width:200px;height: 200px;background-color: green;
            margin: 100px 0 0 100px;
            position: relative;/*在哪里添加就相对谁*/
        }
        #big>div{
            width:100px;height: 100px;background-color: red;
            margin: 50px 0 0 50px;
            position: relative;/*都相对时,采用就近原则*/
        }
        #big>div>div{
            width:50px;height: 50px;background-color: blue;
            position: absolute;/*脱离文档,相对于窗口,*/
            left: 0;
            top: 0;
        }




    </style>
</head>
<body>
<div id="big">
    <div>
        <div></div>
    </div>
</div>
<div id="d1">div1</div>
<div>div2</div>
<div>div3</div>
</body>
</html>